////
//
/// \file ./include/inc/parser/inc/parser/int_type_node.hpp
//
//  Copyright 2007, 2008 Chandler Carruth
//
//  Licensed under the Apache License, Version 2.0 (the "License"); you may not
//  use this file except in compliance with the License.  You may obtain a copy
//  of the License at
//
//    http://www.apache.org/licenses/LICENSE-2.0
//
//  Unless required by applicable law or agreed to in writing, software
//  distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
//  WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
//  License for the specific language governing permissions and limitations
//  under the License.
//
////

#ifndef inc_parser_int_type_node_header
#define inc_parser_int_type_node_header

#include <string>

#include <boost/scoped_ptr.hpp>

#include <inc/parser/parse_tree_node.hpp>

namespace inc {
namespace parser {

class ImmediateNode;
class WSParser;

/// \brief Integer type parse node
/// \author Chandler Carruth
/// \date 2007.08.12
///
/// This parses the integer type specification node. It handles integers of an
/// arbitrary precision cleanly. Note that these are not signed integers. This
/// is a difficult call, and may be reversed at some point. However, integers
/// can be thought of as signed/unsigned, where unsigned integers have no
/// two's-complement representations, and gain an extra bit. They can also be
/// thought of as a collection of bits representing an integral number. The
/// sign of that number depends upon context and operation. Specifically,
/// division and comparison of integers differs based on the sign. Addition,
/// subtraction, and multiplication however do not differ. Furthermore,
/// equality comparison does not differ based on sign. For these reasons, INC
/// currently supports "integers" with operations on them. This also simplifies
/// the question of a signed and an unsigned integer being combined in an
/// operation -- either the *operation* is signed or unsigned, and so are its
/// parameters. The operations which normally require a sign difference are by
/// default signed operations. Special syntax for performing the operations in
/// an unsigned manner will be provided for completeness, but this (ideally)
/// will be very rarely used.

class IntTypeNode : public ParseTreeNode
{
public:
  IntTypeNode();
  virtual ~IntTypeNode();

  virtual bool parse( const iterator& first,
                      const iterator& last,
                      iterator& last_parsed );

  virtual ImmediateNode* get_precision() const;

private:
  boost::scoped_ptr<ImmediateNode> precision;

  boost::scoped_ptr<WSParser> ws;
};

} //  end parser namespace
} //  end inc namespace
#endif  //  inc_parser_int_type_node_header
